package com.itheima;

import com.itheima.dao.OrderDao;
import com.itheima.domain.Order;
import com.itheima.service.OrderService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        //TODO:加载Spring容器,从容器中获取OrderService对象完成根据订单ID查询订单信息并把结果打印到控制台
/*
        1、将UserDao、GoodsDao、OrderDao配置成Spring容器中的bean对象
        2、将UserService、GoodsService、OrderService配置成Spring容器中的bean对象
        3、在UserService、GoodsService、OrderService中使用Setter方式注入对应的Dao并按照要求将代码补全
        4、在OrderService中使用setter方式注入UserService与GoodsService完成订单所属用户及订单所包含商品列表查询
        5、在App中加载Spring容器，获取OrderService对象完成订单信息查询并将其打印至控制台
*/
        ApplicationContext ctx2
                = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderService orderService= (OrderService) ctx2.getBean("OrderService");
        Order order = orderService.findById(1);
        System.out.println(order);
    }
}